import request from "@/utils/request";

// 获取知识管理列表（全部文档）
export function AllList(data) {
  return request({
    url: "/api/extend/FgDocument",
    method: "get",
    data
  });
}

// 修改状态
export function updateStatus(id, status,organizeId) {
  return request({
    url: `/api/extend/FgDocument/updateStatus/${id}/${status}?organizeId=${organizeId}`,
    method: "get"
  });
}

// 添加文件夹
export function Create(data) {
  return request({
    url: `/api/extend/FgDocument`,
    method: "post",
    data
  });
}
//  删除文件/文件夹
export function Delete(id,organizeId) {
  return request({
    url: `/api/extend/FgDocument/${id}?organizeId=${organizeId}`,
    method: "DELETE"
  });
}
// 获取知识管理列表（文件夹树）
export function FolderTree(organizeId) {
  return request({
    url: `/api/extend/FgDocument/FolderTree?organizeId=${organizeId}`,
    method: "get"
  });
}
// 获取文件/文件夹信息
export function FgDocumentInfo(id,organizeId) {
  return request({
    url: `/api/extend/FgDocument/${id}?organizeId=${organizeId}`,
    method: "get"
  });
}
// 修改文件名/文件夹名
export function Update(data) {
  return request({
    url: `/api/extend/FgDocument/${data.id}`,
    method: "PUT",
    data
  });
}
// 移动文件/文件夹
export function MoveTo(id, toId,organizeId) {
  return request({
    url: `/api/extend/FgDocument/${id}/Actions/MoveTo/${toId}?organizeId=${organizeId}`,
    method: "PUT"
  });
}
// 取消分享文件/文件夹
export function ShareCancel(id,organizeId) {
  return request({
    url: `/api/extend/FgDocument/${id}/Actions/Share?organizeId=${organizeId}`,
    method: "DELETE"
  });
}
// 分享文件/文件夹
export function ShareCreate(id, userId,organizeId) {
  return request({
    url: `/api/extend/FgDocument/${id}/Actions/Share`,
    method: "post",
    data: { userId, organizeId: organizeId }
  });
}
// 分享文件至班级
export function ShareCreateClazz(id, clazzid,organizeId) {
  return request({
    url: `/api/extend/FgDocument/${id}/Actions/Share`,
    method: "post",
    data: { clazzid ,organizeId}
  });
}
// 知识管理（我的共享列表）
export function ShareOutList(data) {
  return request({
    url: "/api/extend/FgDocument/Share",
    method: "get",
    data
  });
}
// 获取知识管理列表（共享给我）
export function ShareTomeList(data) {
  return request({
    url: "/api/extend/FgDocument/ShareTome",
    method: "get",
    data
  });
}
// 获取知识管理列表（共享人员）
export function ShareUserList(FgDocumentId,organizeId) {
  return request({
    url: `/api/extend/FgDocument/ShareUser/${FgDocumentId}?organizeId=${organizeId}`,
    method: "get"
  });
}
// 回收站（彻底删除）
export function TrashDelete(id,organizeId) {
  return request({
    url: `/api/extend/FgDocument/Trash/${id}?organizeId=${organizeId}`,
    method: "DELETE"
  });
}
// 获取知识管理列表（回收站）
export function TrashList(data) {
  return request({
    url: "/api/extend/FgDocument/Trash",
    method: "get",
    data
  });
}
// 回收站（还原文件）
export function TrashRecovery(id,organizeId) {
  return request({
    url: `/api/extend/FgDocument/Trash/${id}/Actions/Recovery?organizeId=${organizeId}`,
    method: "post"
  });
}
// 下载文件
export function Download(id,organizeId) {
  return request({
    url: `/api/extend/FgDocument/Download/${id}?organizeId=${organizeId}`,
    method: "post"
  });
}
